package com.jianglin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jianglin.entity.HouseHoldInfo;
import com.jianglin.mapper.HouseHoldInfoMapper;
import com.jianglin.service.HouseHoldInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * @author jianglin
 */
@Service
public class HouseHoldInfoImpl implements HouseHoldInfoService {
    @Autowired
    private HouseHoldInfoMapper houseHoldInfoMapper;
    @Override
    public PageInfo<HouseHoldInfo> findAllHouseHoldInfos(String householdName, int page, int limit) {
        PageHelper.startPage(page, limit);
        List<HouseHoldInfo> list= houseHoldInfoMapper.findAll(householdName);
        return new PageInfo<>(list);
    }

    @Override
    public int saveHouseHoldInfo(HouseHoldInfo houseHoldInfo) {
        return houseHoldInfoMapper.saveHouseHoldInfo(houseHoldInfo);
    }

    @Override
    public int updateHouseHoldInfo(HouseHoldInfo houseHoldInfo) {
        return houseHoldInfoMapper.update(houseHoldInfo);
    }

    @Override
    public int delHouseHoldInfoById(int id) {
        return houseHoldInfoMapper.deleteById(id);
    }

    @Override
    public int delHouseHoldInfoByIds(List<Integer> ids) {
        return houseHoldInfoMapper.delByIds(ids);
    }
}
